﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CallCenter.BLL;
using CallCenter.Properties;

namespace CallCenter
{
    public partial class FormLogin : Form
    {
        public FormLogin()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            string inputUserName = txtUserName.Text;
            string inputPwd = txtPwd.Text;
            SeatsBLL bll = new SeatsBLL();
            if (bll.VerifyUser(inputUserName, inputPwd))
            {
                if (cbRemember.Checked)
                {
                    Settings.Default.Save();
                }
                Global.CurrentSeatId =  bll.GetIdByUserName(inputUserName);
                //MessageBox.Show("OK");
                DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("Error");
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
        }
    }
}
